<?php
/**
 * NOTICE OF LICENSE
 *
 * This source file is subject to the  Academic Free License (AFL 3.0)
 * that is available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to support@zprofess.com so we can send you a copy immediately.
 *
 * @category   	Prestashop module
 * @package		Customer Point
 * @version 	1.0 (March 2012)
 * @author 		xuanhoapro <xuanhoapro@gmail.com>
 * @copyright   Copyright (c) 2012 ZPROFESS. (http://zprofess.com)
 * @license    	http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
/**
 * @see Zmodule
 */
require_once(_PS_MODULE_DIR_.'zcustomerpoint/lib/zprofess/ZCustomerPointModule.php');

class ZCustomerPointConfig extends ZCustomerPointModule
{	
	/**
	 * Destroy var config
	 * Configuration::deleteByName('ZCP_VERSION');
	 * @return boolean
	 */
 	public function destroyConfiguration () {
 		
		return true;
	} 
    /**
     * Init var config
     * Configuration::updateValue('ZCP_VERSION',$this->vesion);
     * @return boolean
     */
	public function initConfiguration() {
		
		return true;
	}
	
	/**
	 * process date post from form config
	 * 
	 * @return void
	 */
	private function _postProcess()
	{
		$this->_msg = '';
		if (Tools::isSubmit('submitConfigPoints'))
		{
			
			Configuration::updateValue('ZPOINTS_REG', (int)Tools::getValue('ZPOINTS_REG'));
			Configuration::updateValue('ZPOINTS_PARENT', (int)Tools::getValue('ZPOINTS_PARENT'));
			Configuration::updateValue('ZPOINTS_TIME', (int)Tools::getValue('ZPOINTS_TIME'));
			Configuration::updateValue('ZPOINTS_FALSE', (int)Tools::getValue('ZPOINTS_FALSE'));
			Configuration::updateValue('ZPOINTS_TRUE', (int)Tools::getValue('ZPOINTS_TRUE'));
			Configuration::updateValue('ZTIMES_ADD', (int)Tools::getValue('ZTIMES_ADD'));	
			Configuration::updateValue('ZTIMES_DELAY', (int)Tools::getValue('ZTIMES_DELAY'));
			Configuration::updateValue('ZPOINTS_LIKE', (int)Tools::getValue('ZPOINTS_LIKE'));
			Configuration::updateValue('ZPOINTS_COMMENT', (int)Tools::getValue('ZPOINTS_COMMENT'));
//			Configuration::updateValue('PL_ET_NUM_WORDS', Tools::getValue('POINTS_REG'));
//			Configuration::updateValue('PL_ET_ITEM_PAGE', Tools::getValue('POINTS_REG'));
//			Configuration::updateValue('PL_ET_TMP_WIDTH', Tools::getValue('POINTS_REG'));
//			Configuration::updateValue('PL_ET_TMP_HEIGHT', Tools::getValue('POINTS_REG'));
//			Configuration::updateValue('PL_ET_LIST_WIDTH', Tools::getValue('POINTS_REG'));
//			Configuration::updateValue('PL_ET_LIST_HEIGHT', Tools::getValue('POINTS_REG'));
//			Configuration::updateValue('PL_ET_SLIDE_HEIGHT', Tools::getValue('POINTS_REG'));
//			Configuration::updateValue('PL_ET_SLIDE_DELAY', Tools::getValue('POINTS_REG'));
			
			$this->_msg = $this->displayConfirmation('Cài đặt thành công');
			
		}
		
	}
	
	/*
	 * Display configuration page of module.
	 * 
	 * @return string html
	 */
	public function getContent() 
	{
		$this->_postProcess();
		return '<h2>'.$this->displayName.'</h2>'.$this->_msg.$this->_displayForm();
	}
		
	/**
	 * Display form General Settings
	 * 
	 * @return string html
	 */
	private function _displayFormGeneral()
	{
		return '';
	}
}